@echo off
if {%1}=={debug} SET bld=debug
if {%1}=={} SET bld=debug
if {%1}=={release} set bld=release

devenv enyo2.sln /clean
devenv enyo2.sln /rebuild %bld% /out buildlog.txt

if errorlevel 1 goto :ERROR

type buildlog.txt>>..\buildlog.txt
del buildlog.txt

..\Tools\setcolor green
echo Build success.

copy Enyo2\bin\%bld%\enyo2.dll .\..\CoreTarget\
copy Onyx\bin\%bld%\onyx.dll .\..\CoreTarget\


..\Tools\setcolor
goto :END

:ERROR
..\Tools\setcolor red
echo Build fail. Find detail information in build log.
..\Tools\setcolor
type buildlog.txt>>..\buildlog.txt
del buildlog.txt

:END